
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<title>Services Directory&trade; Departments</title>
<!-- Combined stylesheets load -->
<!-- Load either 960.gs.fluid or 960.gs to toggle between fixed and fluid layout -->
<link href="css/main.css"
	tppabs="http://www.display-inline.fr/demo/constellation/template/css/mini.php?files=reset,common,form,standard,960.gs.fluid,simple-lists,block-lists,planning,table,calendars,wizard,gallery"
	rel="stylesheet" type="text/css">
<!-- Modernizr for support detection, all javascript libs are moved right above </body> for better performance -->
<script src="js/libs/modernizr.custom.min.js"
	tppabs="http://www.display-inline.fr/demo/constellation/template/js/libs/modernizr.custom.min.js"></script>
<link href="css/cssTable.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/lib.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>

<script type="text/javascript">
	$(document).ready(function() {
		//Bat su kien click vao nut check box
		$('#checkboxActive').click(function() {
			var thisCheck = $(this);
			if (thisCheck.is(':checked')) {
				$('form#getIncludeAcvive #id_includeInActive').val(true);
				$('form#getIncludeAcvive').submit();
			} else {
				$('form#getIncludeAcvive #id_includeInActive').val(false);
				$('form#getIncludeAcvive').submit();
			}

		});
	});
</script>
<script type="text/javascript">
	function validateDirectorate() {

		var errorMessage = "";
		if (errorMessage != "") {
			$("#errorMessage").empty().html(errorMessage);
			return false;
		} else {
			document.forms['updateForm'].submit();
		}
	}

	function changeIsActive() {
		var elem = document.getElementById("activeDirectorate");
		var isActive = document.getElementById("active");
		// 		alert(elem.innerHTML + "\n" + "<span class=\"smaller\"><img src=\"images/icons/fugue/flag.png\" width=\"16\" height=\"16\"><strong class=\"tmpAc\">In-active</strong></span>");
		if (elem.innerHTML == "<span class=\"smaller\"><img src=\"images/icons/fugue/flag.png\" width=\"16\" height=\"16\"><strong class=\"tmpAc\">In-active</strong></span>") {
			var confirmActive = confirm("Are you sure to In-active this directorate?");
			if (confirmActive) {
				elem.innerHTML = "<span class='smaller'><img height='16' width='16' src='images/icons/fugue/flag.png' /><strong class='tmpAc'>Active</strong></span>";
				isActive.value = 0;
			}
		} else {
			var confirmDeactive = confirm("Are you sure to active this directorate?");
			if (confirmDeactive) {
				elem.innerHTML = "<span class='smaller'><img height='16' width='16' src='images/icons/fugue/flag.png' /><strong class='tmpAc'>In-active</strong></span>";
				isActive.value = 1;
			}
		}
	}
</script>
</head>
<body>

	<%@include file='header.jsp'%>
	<!-- Status bar -->
	<div id="status-bar">
	</div>
	<!-- End status bar -->


	<section class="grid_8">
	<div class="block-border">
		<form class="block-content form" id="complex_form" method="post"
			action="insert" name="updateForm">
			<h1>Business Unit/Directorate Details</h1>
			<div class="block-controls"></div>
			<ul class="message warning no-margin">
				<li id="message">This is a <strong>warning message</strong>,
					inside a box</li>
				<li class="close-bt"></li>
			</ul>
			<div class="columns">
				<div>
					<ul class="tabs js-tabs same-height">
						<li class="current"><a href="#tab-details1">Details</a></li>

					</ul>
					<div class="float-right" style="margin: -2.5em 2em 0 0;">
						<s:if test="directorateVO.active==1">
							<a class="button" id="activeDirectorate" title="In-active"
								href="#" onclick="changeIsActive()"><span class="smaller"><img
									src="images/icons/fugue/flag.png" height="16" width="16"><strong
									class="tmpAc">In-active</strong> </span> </a>
						</s:if>
						<s:if test="directorateVO.active==0">
							<a class="button" id="activeDirectorate" title="Active" href="#"
								onclick="changeIsActive()"><span class="smaller"><img
									src="images/icons/fugue/flag.png" height="16" width="16"><strong
									class="tmpAc">Active</strong> </span> </a>
						</s:if>
						<a class="button" title="Save" style="cursor: pointer;"
							onclick="ValidateData()" id="saveBtn"> <span
							class="smaller"><img height="16" width="16"
								src="images/icons/fugue/tick-circle.png"><strong>
									Save </strong> </span> </a> <a class="button" title="Back"
							href="javascript:history.back();" >
							<span class="smaller"><img height="16" width="16"
								src="images/icons/fugue/navigation-180.png"><strong>
									Back </strong> </span> </a>

					</div>
						
					<div class="tabs-content">
					
						<!-- Tab details 1 -->
						<div id="tab-details1" style="overflow: hidden;">
							<div style="float: left; width: 48%; overflow: hidden">
								<p class="colx2-left">

									<s:hidden name="directorateVO.directorateID"
										id="directorate.directorateID" />
									<s:hidden name="directorateVO.active" id="active" />
								</p>
								<p class="colx2-left"
									style="width: 100%; margin-bottom: 10px; float: left;">
									<label for="complex-en-url"
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%">BU/Directorate
										Name<font color="red">*</font></label>
									<s:textfield required="true" type="text" name="directorateVO.directorateName"
										cssClass="full-width" style="width: 52%;" />
								</p>

								<p class="colx2-left"
									style="width: 100%; margin-bottom: 10px; float: left;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">BU/Directorate
										Short Description</label>
									<s:textarea name="directorateVO.shortDes"
										style="width: 52%" ></s:textarea>
								</p>

								<p class="colx2-left"
									style="width: 100%; margin-bottom: 10px; float: left;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">Lead
										Contact</label>
									<s:textfield name="firstname" required="true"
										style="width: 40%;" id="lu.contactName" readonly="true" />
									<a href="javascript: void(0);" style="width: 20%"
										onclick="return popitup('search.action?contact.firstName=&contact.surName=')">Lookup</a>
								</p>
								<input type="checkbox" /> Copy Address from Organisation <br />
								<br />
								<p class="colx2-left"
									style="width: 100%; margin-bottom: 10px; float: left;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">Address
										Line 1<font color="red">*</font></label>
									<s:textfield type="text" name="directorateVO.addr1" required="true"
										style="width: 52%;" id="lu.address_line1" />
								</p>

								<p class="colx2-left"
									style="width: 100%; margin-bottom: 10px; float: left;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">Address
										Line 2</label>
									<s:textfield name="directorateVO.addr2" required="true"
										style="width: 52%;" id="addressLine2" />
								</p>
								<p class="colx2-left"
									style="width: 100%; margin-bottom: 10px; float: left;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">Address
										Line 3</label>
									<s:textfield name="directorateVO.addr3" required="true"
										style="width: 52%;" id="addressLine3" />
								</p>

								<p class="colx2-left"
									style="width: 100%; margin-bottom: 10px; float: left;">
									<label for="complex-en-url"
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">Postcode<font color="red">*</font></label>
									<s:textfield name="directorateVO.postcode" required="true"
										style="width: 40%;" id="lu.postCode" readonly="true" />
									<a href="javascript: void(0);"
										onclick="return popitup('add_lookup.action?address.postCode=&address.addressName=&address.townName=')">Lookup</a>
								</p>

								<p class="colx2-left"
									style="width: 100%; margin-bottom: 10px; float: left;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">Town/Village/City</label>
									<s:textfield name="directorateVO.townName" required="true"
										style="width: 52%;" id="lu.townName" readonly="true" />
								</p>

								<p class="colx2-left"
									style="width: 100%; margin-bottom: 10px; float: left;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">County</label>
									<s:textfield name="directorateVO.countyName" required="true"
										style="width: 52%;" id="lu.countyName" readonly="true" />
								</p>
								<p class="colx2-left"
											style="width: 100%; margin-bottom: 10px; float: left;">
											<label for="complex-en-url"
												style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">Nation/Country</label>
											<select name="directorateVO.countryName" id="lu.countryName"
												class="full-width" style="width: 56%;">
												<option value=""></option>
											</select>
										</p>
							</div>


							<!-- right -->


							<div style="float: right; width: 48%">

								<p class="colx2-right" style="width: 100%; margin-bottom: 10px;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">Type
										of Bussiness<font color="red">*</font> </label>
									<s:textfield name="businessName" 
										style="width: 38%;" id="lu.businessName" readonly="true"/>
									<a href="javascript: void(0);"
										onclick="return popitup('bus_lookup.action?business.businessName=&business.sicCode=')">Lookup</a>
								</p>


								<p class="colx2-right" style="width: 100%; margin-bottom: 10px;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">
										SIC Code</label>
									<s:textfield name="sicCode" required="true" style="width: 50%;"
										id="lu.sicCode" readonly="true" />

								</p>

								<p class="colx2-right" style="width: 100%; margin-bottom: 10px;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">
										BU/Directorate Full Description</label>
									<s:textarea name="directorateVO.fullDesc"
										style="width: 50%;"></s:textarea>
								</p>

								<p class="colx2-right" style="width: 100%; margin-bottom: 10px;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">
										Phone Number</label>
									<s:textfield name="directorateVO.phoneNumber"
										cssClass="full-width" style="width: 52%;"></s:textfield>
								</p>
								<p class="colx2-right" style="width: 100%; margin-bottom: 10px;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">
										Fax</label>
									<s:textfield name="directorateVO.fax" cssClass="full-width"
										style="width: 52%;"></s:textfield>
								</p>
								<p class="colx2-right" style="width: 100%; margin-bottom: 10px;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">
										Email</label>
									<s:textfield name="directorateVO.email" cssClass="full-width"
										style="width: 52%;"></s:textfield>
								</p>
								<p class="colx2-right" style="width: 100%; margin-bottom: 10px;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">
										Web Address</label>
									<s:textfield name="directorateVO.webAddr"
										cssClass="full-width" style="width: 52%;"></s:textfield>
								</p>
								<p class="colx2-right" style="width: 100%; margin-bottom: 10px;">
									<label
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">
										Chairity Number</label>
									<s:textfield name="directorateVO.charityNumber"
										cssClass="full-width" style="width: 52%;"></s:textfield>
								</p>
								<p class="colx2-right" style="width: 100%; margin-bottom: 10px;">
									<label for="complex-en-subtitle"
										style="line-height: 30px; float: left; margin-right: 20px; width: 38%;">
										Company Number</label>
									<s:textfield name="directorateVO.companyNumber"
										cssClass="full-width" style="width: 52%;"></s:textfield>
								</p>
								<p class="colx2-right">
									<s:hidden name="directorateVO.contactID" id="lu.contactId" />
									<s:hidden name="addressID" id="target5" />
									<s:hidden name="businessID" id="businessID" />
									<s:hidden name="orgID" id="orgID" />
									<s:hidden name="directorateVO.typeOfBusinessID" id="lu.typeOfBusinessID" />

								</p>
							</div>
						</div>
						<!--End #tab-details1-->



					</div>
				</div>

			</div>

		</form>
	</div>
	</section>
</body>
</html>
<script>
function ValidateData() {
	var x = document.forms[0]["directorateVO.directorateName"].value;
	var y = document.forms[0]["directorateVO.addr1"].value;
	var z = document.forms[0]["directorateVO.postcode"].value;
	var w = document.forms[0]["businessName"].value;
	var k = true;
	
	var MyPara = "";
	if (x == null || x == "") {
		MyPara = MyPara
				+ "Directorate name must be filled out<br><br/>  ";
		k = false;
	}
	if (y == null || y == "") {
		MyPara = MyPara
				+ "Address Line 1 must be filled out<br><br/>  ";
		k = false;
	}
	if (z == null || z == "") {
		MyPara = MyPara
				+ "Postcode must be filled out<br><br/>  ";
		k = false;
	}
	if (w == null || w == "") {
		MyPara = MyPara
				+ "Type of business must be filled out<br><br/>  ";
		k = false;
	}
	if (k == false) {
		document.getElementById('message').innerHTML = MyPara;
		var myPara = document.getElementById('message');
		myPara.style.color = "red";
	} else {
		
		document.forms['updateForm'].submit();
	}
}

	
</script>